-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
44 lines (32 loc) · 1002 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
DecimalFormat format = new DecimalFormat("0.000");
int c, n;
c = sc.nextInt();
for (int i = 0; i < c; i++) {
n = sc.nextInt();
double por = 100D;
int cout = 0;
int res = 0;
int[] alu = new int[n];
for (int j = 0; j < n; j++) {
alu[j] = sc.nextInt();
res += alu[j];
}
double med = (double) res / n;
for (int j = 0; j < n; j++) {
if (alu[j] > med)
cout++;
}
por *= ((double) cout / n);
System.out.println(format.format(por) + "%");
}
sc.close();
}
}